﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TY.Utilities;

namespace TY_75Stability.WinApp
{

    public class SysControl
    {
        public event Action ShowFormEvent;
        public event Action MoveFormEvent;
        public event Action CloseFormEvent;

        public event Action<String> InitCameraEvent;
        public event Action ShowCameraEvent;
        public event Action HideCameraEvent;
        public event Func<string, string, string> SaveFileDialogEvent;
        public void ShowForm()
        {
            ShowFormEvent?.Invoke();
        }
        public void MoveForm()
        {
            MoveFormEvent?.Invoke();
        }
        public void CloseForm()
        {
            CloseFormEvent?.Invoke();
        }
        public void InitCamera(string ip)
        {
            InitCameraEvent?.Invoke(ip);
        }
        public void ShowCamera()
        {
            ShowCameraEvent?.Invoke();
        }
        public void HideCamera()
        {
            HideCameraEvent?.Invoke();
        }
        public void OpenExplore(string path)
        {
            System.Diagnostics.Process.Start(path);
        }
        public event Func<string> SelectPathEvent;
        public string SelectPath()
        {
            return SelectPathEvent?.Invoke();
        }
        public event Func<string> GetVideoPathEvent;
        public string GetVideoPath()
        {
            return GetVideoPathEvent?.Invoke();
        }
        public event Func<string, string> SaveVideoPathEvent;
        public string SaveVideoPath(string videoPath)
        {
            return SaveVideoPathEvent?.Invoke(videoPath);
        }
        public string SaveFileDialog(string title, string defaultFileName)
        {

            return SaveFileDialogEvent?.Invoke(title, "热稳定性试验装置报表_" + Utils.GetRamCode() + ".xlsx");
        }

        public double GetHardDiskSpace(string path)
        {
            return Math.Round(Utils.GetHardDiskSpace(path.Substring(0, path.IndexOf(':'))) / 1024.0, 2);
        }

    }
}
